package cd.cdyb.sms.controller;


import cd.cdyb.sms.dto.PageResult;
import cd.cdyb.sms.dto.query.SystemLogQueryDto;
import cd.cdyb.sms.exception.BusinessException;
import cd.cdyb.sms.service.SystemLogService;
import cd.cdyb.sms.domain.SystemLog;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author lin
 * @since 2024-04-18
 */
@RestController
@RequestMapping("/systemLog")
public class SystemLogController {

    @Resource
    private SystemLogService systemLogService;

    /**
     * 分页
     */
    @PostMapping("/findSystemLogPage")
    public PageResult<SystemLog> findSystemLogPage(@RequestBody SystemLogQueryDto systemLogQueryDto) throws BusinessException {
        if (Objects.isNull(systemLogQueryDto.getStartTime())) {
            throw new BusinessException("开始时间不能为空");
        }
        if (Objects.isNull(systemLogQueryDto.getEndTime())) {
            throw new BusinessException("开始时间不能为空");
        }
        return systemLogService.findSystemLogPage(systemLogQueryDto);
    }

}

